Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | /** * Iframe-safe embed of a public song share — what Twitter Player Card, * Discord, and Mastodon load inline when someone pastes a `/song/[code]` * link in those clients. * * Tiny on purpose: just the player + a minimal Abaci.One attribution corner * that links back to the full keepsake page. No nav, no stats panel, no * decorative background — chat embeds are small and any chrome competes * with the song. * * Uses the same `getSharedSong` privacy boundary as the full page (no * `bumpView` — embed loads shouldn't inflate the human view counter). */ import { notFound } from 'next/navigation' import { SharedSongPlayerCard } from '@/components/song-share/SharedSongPlayerCard' import { getSharedSong } from '@/lib/song-share/getSharedSong' import { css } from '@styled/css' export const dynamic = 'force-dynamic' interface Props { params: Promise<{ code: string }> } const ORIGIN = process.env.NEXT_PUBLIC_APP_URL ?? 'https://abaci.one' export default async function EmbedSongPage({ params }: Props) { const { code } = await params const payload = await getSharedSong(code) // no bumpView if (!payload) notFound() const { player, song, visibility } = payload return ( <div data-component="embed-song" className={css({ position: 'relative', minH: '100vh', bg: '#0f172a', display: 'flex', flexDirection: 'column', p: '12px', })} > <div className={css({ flex: 1, display: 'flex', flexDirection: 'column', justifyContent: 'center', gap: '10px', })} > <div className={css({ display: 'flex', alignItems: 'center', gap: '10px', color: 'white', })} > <span className={css({ w: '36px', h: '36px', borderRadius: '50%', bg: 'white', color: 'gray.900', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '22px', flexShrink: 0, })} > {player.emoji} </span> <div className={css({ display: 'flex', flexDirection: 'column' })}> <span className={css({ fontSize: '11px', color: 'gray.400' })}>A song for</span> <span className={css({ fontFamily: 'display', fontWeight: 700, fontSize: '18px', lineHeight: 1.1, })} > {player.name} </span> </div> </div> <SharedSongPlayerCard audioPath={song.audioPath} alignmentPath={song.alignmentPath} lyrics={song.sections} title={song.title} variant="full" autoPlay={visibility.autoPlay} /> </div> <a href={`${ORIGIN}/song/${code}`} target="_blank" rel="noopener noreferrer" className={css({ mt: '8px', alignSelf: 'flex-end', fontSize: '11px', color: 'gray.400', textDecoration: 'none', letterSpacing: '0.04em', fontWeight: 600, _hover: { color: 'white' }, })} > Made on Abaci.One ↗ </a> </div> ) } |